﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HF.User.Data;

public partial class WorkLogin : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       // Label1.Text = System.Web.HttpContext.Current.Request.UserHostAddress; 

    }

    protected void button_Click(object sender, ImageClickEventArgs e)
    {
        string UserID = tbxUserId.Text.Trim();
        string PassWord = tbxPassWord.Text.Trim();

        if (UserData.GetInstance().LoginCheck(tbxUserId.Text, tbxPassWord.Text))
        {
            FormsAuthentication.RedirectFromLoginPage(tbxUserId.Text, false);
            string ReturnUrl = "";
            if (Request["ReturnUrl"] != null)
            {
                ReturnUrl = Request["ReturnUrl"].ToString();
                Response.Redirect(ReturnUrl);
            }
            else
                Response.Redirect("Default.aspx");

        }
        else
        {
            lblMessage.Text = "帐号或者密码错误!";
        }
    }
   
}
